Info For
The Info For command returns a record that contains information about a specified file or folder. The Info For command is one of several commands provided by the File Commands scripting addition.SYNTAX
info for referenceToFilePARAMETER
- referenceToFile
- A reference of the form
file
nameString oralias
nameString.
Class: ReferenceRESULT
A record of object class File Info (defined by the File Commands scripting addition) that contains the following properties:
name
- Name of file or folder.
Class: Stringcreation date
- Date and time the file or folder was first created.
Class: Datemodification date
- Date and time the file or folder was last modified.
Class: Dateicon position
- Location of the upper-left corner of the file or folder's icon.
Class: Point (defined by the QuickDraw suite as a two-item list of integers for horizontal and vertical coordinates)visible
- A value that indicates whether the file or folder's icon is visible on the desktop (
true
) or not (false
).
Class: Boolean
Modifiable? Nosize
- The size of the file or folder in bytes.
Class: Integer
Modifiable? Nofolder
- A value that indicates whether the object described by the File Info record is a folder (
true
) or a file (false
).
Class: Boolean
Modifiable? Noalias
- Indicates whether the file is an alias (
true
) or not (false
).
Class: Boolean
Modifiable? Nofolder window
- Four integers that specify the bounding rectangle of the folder window. Returned for folders only.
Class: Bounding rectangle (a list of four integers)
Modifiable? Nolocked
- Indicates whether the file or folder is locked (
true
) or unlocked (false
).
Class: Boolean
Modifiable? Nofile creator
- Four-character creator code of the file. Returned for files only.
Class: String
Modifiable? Nofile type
- Four-character code for the file type of the file. Returned for files only.
Class: String
Modifiable? Noshort version
- The file's short version, if any. Returned for files only.
Class: String
Modifiable? Nolong version
- The file's long version, if any. Returned for files only.
Class: String
Modifiable? Nodefault application
- The default application for a nonapplication file (for example, TeachText). Used with nonapplication files only.
Class: Alias
Modifiable? NoEXAMPLES
This example returns the entire File Info record for Scriptable Text Editor.
info for file "Hard Disk:Scriptable Text Editor"--result: {name:"Scriptable Text Editor", creation date:date "Tuesday, April 6, 1993 11:30:00 AM", modification date:date "Tuesday, April 6, 1993 11:30:00 AM", icon position:{20, 349}, visible:true, size:88988, folder:false, alias:false, locked:false, file creator:"quil", file type:"APPL", short version:"1.1", long version:"1.1, Copyright © Apple Computer, Inc. 1991-93"}This example returns just the file type for Scriptable Text Editor.
set x to info for ¬ file "Turing's World:Scriptable Text Editor"x's file type --result: "APPL"This example displays a dialog box if the Scriptable Text Editor isn't locked.
if locked of ¬ (info for file "Hard Disk:Scriptable Text Editor") ¬ is false then display dialog "Scriptable Text Editor is not locked."end ifNOTES
To specify the name (nameString) of a file, use a string of the form"Disk:Folder1:
as described in Chapter 5, "Objects and References,"
Folder2:...:Filename"
of the AppleScript Language Guide. If you specify only the name of the file (Filename) instead of its entire pathname, AppleScript attempts to find the file in the current directory.ERRORS